#include <iostream>
#include <vector>

using namespace std;

const int N = 2e5 + 10;

typedef pair<int, int> PII;

int a[N], b[N];
int T, n;
vector<PII> ans;

int main()
{
	cin >> T;
	while(T--)
	{
		cin >> n;
		for(int i = 1; i <= n; i++) cin >> a[i];
		int x = 0;
		for(int i = 1; i <= n; i++)
		{
			cin >> b[i];
			if(a[i] == b[i]) x++;
		}
		if(x & 1 && x != 1) cout << "-1" << endl;
		else if(x % 2 == 0 && x != 0) cout << "-1" << endl;
		else
		{
			if(x == 1)
			{
				for(int i = 1; i <= n; i++)
				{
					if(a[i] == b[i])
					{
						ans.push_back({i, n / 2 + 1});
						swap(a[i], a[n / 2 + 1]);
						swap(b[i], b[n / 2 + 1]);
						break;
					}
				}
			}
		}
	}
	return 0;
}
